﻿using System;
class PrimeNumberCheck
{
    static void Main()
    {
        int testnumber = 0;
        int remainder;
        Console.Write("Input Number: ");
        do
        {
            if (testnumber != 0)
            {
                Console.Write("Please re-enter number from 2 to 100: ");
            }
            while (true)
            {
                try
                {
                    testnumber = int.Parse(Console.ReadLine());
                    break;
                }
                catch (Exception ex)
                {
                    Console.Write(ex.Message + "\nPlease re-enter number:");
                }
            }
        } while ((testnumber <= 1) || (testnumber > 100));
        float divisor = 2.0f;
        do
        {         
            remainder = testnumber % (int)divisor;
            Console.WriteLine("division result: "+(testnumber / divisor)+" with num remainder: "+remainder);
            divisor = divisor + 1;
        } while(remainder!=0);
        if ((testnumber) == (divisor - 1))
        {
            Console.WriteLine("The number is prime");
            Console.ReadLine();
        }
        else
        {
            Console.WriteLine("The number is NOT prime");
            Console.ReadLine();
        }
    }
}

